package SpringIOC;

import fifthDemo.impl.chinese;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class IOCTest {
    public static void main(String[] args) {
        //ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        ApplicationContext applicationContext = new FileSystemXmlApplicationContext("E:\\javacode\\day02Spring\\src\\applicationContext.xml");
        Person chinese = (Person) applicationContext.getBean("factory");
        System.out.println(chinese.toString());
        chinese.eat();
        Person japan = applicationContext.getBean("person", Person.class);
        System.out.println(japan.toString());
        japan.eat();
        Person goodMan = applicationContext.getBean("goodMan", Person.class);
        System.out.println(goodMan.toString());
    }
}
